package com.example.lib_base.base.activity

import android.os.Bundle
import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity

abstract class BaseActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        initContentView()
        initialize(savedInstanceState)
    }

    /**
     * 初始化视图
     */
    protected open fun initContentView() {
        setContentView(getLayoutId())
    }

    /**
     * 设置视图资源id
     */
    @LayoutRes
    protected abstract fun getLayoutId(): Int

    /**
     *  初始化操作
     */
    protected abstract fun initialize(savedInstanceState: Bundle?)

}